/**      
 * @file		TowersOfHanoi.cpp
 * @description		This is the final recursive demonstration I have for you.
 *			It uses the Towers of Hanoi problem and solves it using
 *			recursion. For more information on the Towers of Hanoi
 *			see <a href="http://en.wikipedia.org/wiki/Tower_of_Hanoi">Tower of Hanoi</a>
 * @course		CSCI 123 Section 00000
 * @assignment 
 * @date		mm/dd/yyyy
 * @author		Brad Rippe (00000000) brippe@fullcoll.edu
 * @version		1.0
 */
#include <iostream>
using namespace std;

/**
 * The function for finding the solution to move n disks
 * from fromTower to toTower with auxTower 
 * @param aN			the number of disks to be moved
 * @param aFromTower	the tower to move the disks from
 * @param aToTower		the tower to move the disks to
 * @param aAuxTower		the tower used to move the disks
 *
 */
void moveDisks(int aN, char aFromTower, char aToTower, char aAuxTower);

/**
 * @return zero if the application executes successfully
 */
int main() {
	// Read number of disks, n
	cout << "Enter number of disks: ";
	int n;
	cin >> n;

	// Find the solution recursively
	cout << "The moves are: " << endl;
	moveDisks(n, 'A', 'B', 'C');
	return 0;
}

void moveDisks(int aN, char aFromTower, char aToTower, char aAuxTower) {
	if (aN == 1) { // Stopping condition
		cout << "Move disk " << aN << " from " <<
			aFromTower << " to " << aToTower << endl;
	} else {
		moveDisks(aN - 1, aFromTower, aAuxTower, aToTower);
		cout << "Move disk " << aN << " from " <<
			aFromTower << " to " << aToTower << endl;
		moveDisks(aN - 1, aAuxTower, aToTower, aFromTower);
	}
}
